import streamlit as st import azure import azure-mgmt-compute import azure-mgmt-storage import azure-mgmt-resource import azure-keyvault-secrets import azure-storage-blob from azure.identity import DefaultAzureCredential from azure.keyvault.secrets import SecretClient # Define Azure Key Vault and Secret Name azure_key_vault_url = "https://your-keyvault-name.vault.azure.net/" secret_name = st.text_input("Enter Secret Name:", value="your-secret-name") # Initialize Azure credential credential = DefaultAzureCredential() # Initialize Secret Client secret_client = SecretClient(vault_url=azure_key_vault_url, credential=credential) # Streamlit App st.title("Azure Authentication Example") # Authenticate to Azure Key Vault if st.button("Authenticate", emoji="🔒"): try: secret_value = secret_client.get_secret(secret_name).value st.success("Successfully authenticated to Azure Key Vault.") except Exception as e: st.error(f"Authentication failed: {str(e)}") # Display secret value if secret_value: st.subheader("Secret Value") st.write(f"The secret value from Azure Key Vault is: {secret_value}") # Optional: You can add more Streamlit components and functionality as needed