Spaces:
Build error
Build error
File size: 1,225 Bytes
c0bcec9 b9c0a03 c00021a c0bcec9 987065f c0bcec9 987065f c0bcec9 987065f c0bcec9 |
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 |
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
|